package com.example.springboot_test.easyexcel.model;

import com.example.springboot_test.easyexcel.model.builder.CellStyleModelBuilder;
import com.example.springboot_test.easyexcel.model.common.SheetCellModel;
import lombok.Getter;

/**
 * 样式信息类(Builder构建者模式)
 *
 * @author xudongmaster
 */
@Getter
public class CellStyleModel extends SheetCellModel {
    /**
     * 样式信息
     */
    private final StyleModel styleModel;

    public CellStyleModel(CellStyleModelBuilder builder) {
        this.sheetName = builder.getSheetName();
        this.colIndex = builder.getColIndex();
        this.rowIndex = builder.getRowIndex();
        this.styleModel = builder.getStyleModel();
    }

    /**
     * 生成样式信息
     *
     * @param sheetName   sheet页名称
     * @param rowIndex    行号
     * @param columnIndex 列号
     * @param styleModel  样式信息
     * @return 样式信息
     */ 
    public static CellStyleModel createCellStyleModel(String sheetName, int rowIndex, int columnIndex
            , StyleModel styleModel) {
        return CellStyleModelBuilder.builder(sheetName, rowIndex, columnIndex
                , styleModel).build();
    }

}